<?php
namespace app\serverintegralmall\service\goods;
use \app\manage\service\ApiBase;
/**
 * @author:      李颖
 * @DateTime:    2017-10-31 10:17:50
 * @Description: 积分商城 - 商品
 */
class Goods extends ApiBase{
	

	protected $goodsLogic = '\app\serverintegralmall\logic\Goods';
    protected $goodsValidate = '\app\serverintegralmall\validate\Goods';

    use \app\serveruser\traits\AddAppIdToRunOne;

    /*艺货后台发布积分商品*/
    public function addIntegralGoods(): array 
    {
    	$data = $this->haveIssetReceiveData(['cate_id'=>0, 'title'=>' ', 'integral'=>0, 'profile_pic'=>'', 'imgs_urls'=>' ', 'imgs_ids'=>' ', 'origin_number'=>0, 'order'=>0, 'desc'=>' ', 'token'=>' ']);
        return $this->stepRun($data, 'serveruser/auth/Token/hGetAll,serveruser/auth/App/find,servercoding/coding/Coding/getCoding,serverintegralmall/goods/Goods/addIntegralGoods', '', 'addIntegralGoods', '1', $this->goodsValidate, $this->goodsLogic);
    }

    /*后台修改积分商品*/
    public function updateIntegralGoods(): array 
    {
    	$data = $this->issetReceiveData(['id'=>0, 'cate_id'=>0, 'title'=>' ', 'integral'=>0, 'profile_pic'=>'', 'imgs_urls'=>' ', 'imgs_ids'=>' ', 'number'=>0, 'origin_number'=>0, 'order'=>0, 'desc'=>' ', 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/updateIntegralGoods', $this->goodsValidate, $this->goodsLogic);
    }

    /*艺货后台获取积分商品分页列表*/
    public function allGoodsList(): array 
    {
        $data = $this->haveIssetReceiveData(['keywords'=>'', 'page'=>1, 'listRows'=>15, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/allGoodsList', $this->goodsValidate, $this->goodsLogic);
    }

    /*管理员下架某一个商品*/
    public function soldOutOneGoods(): array 
    {
        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/soldOutOneGoods', $this->goodsValidate, $this->goodsLogic);
    }

    /*管理员下架某一批商品*/
    public function soldOutBatchGoods(): array 
    {
        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/soldOutBatchGoods', $this->goodsValidate, $this->goodsLogic);
    }

    /*管理员删除商品*/
    public function manageDelGoods(): array 
    {
        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/manageDelGoods', $this->goodsValidate, $this->goodsLogic);
    }

    /*管理员批量删除商品*/
    public function manageBatchDelGoods(): array 
    {
        $data = $this->haveIssetReceiveData(['id'=>[], 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/Goods/manageBatchDelGoods', $this->goodsValidate, $this->goodsLogic);
    }











}